import axios from '@/libs/api.request'
import qs from 'qs'

export const getTableData = (params) => {
  return axios.request({
    url: 'admins/equipment/page?t='+new Date().getTime(),
    params,
    method: 'get'
  })
}
export const getTableData0 = (params) => {
  return axios.request({
    url: 'admins/equipmentTmp/page?t='+new Date().getTime(),
    params,
    method: 'get'
  })
}

export const findById = (params) => {
  return axios.request({
    url: 'admins/equipment/findById?t='+new Date().getTime(),
    params,
    method: 'get'
  })
}

export const add = (data) => {
  return axios.request({
    url: 'admins/equipment/add',
    data: qs.stringify(data),
    method: 'post'
  })
}

export const update = (data) => {
  return axios.request({
    url: 'admins/equipment/update',
    data: qs.stringify(data),
    method: 'post'
  })
}

export const del = (data) => {
  return axios.request({
    url: 'admins/equipment/delete',
    data: qs.stringify(data),
    method: 'post'
  })
}
// 根据字典码获取字典表
export const getSelectOption = (params) => {
  return axios.request({
    url: 'admins/dataDict/getDictByCode?t='+new Date().getTime(),
    method: 'get',
    params
  })
}

// 编辑
export const editTable = (data) => {
  return axios.request({
    url: 'admins/equipment/edit',
    method: 'post',
    data: qs.stringify(data)
  })
}
// 维修计划
export const repairTable = (params) => {
  return axios.request({
    url: 'admins/maintainPlan/getListPageByAircrewNumber?t='+new Date().getTime(),
    method: 'get',
    params
  })
}
// 试验记录
export const testTable = (params) => {
  return axios.request({
    url: 'admins/experimentRecord/getListPageByAircrewNumber?t='+new Date().getTime(),
    method: 'get',
    params
  })
}
// 运行记录
export const runTable = (params) => {
  return axios.request({
    url: 'admins/aircrewStatusRecord/getListPageByAircrewNumber?t='+new Date().getTime(),
    method: 'get',
    params
  })
}
// 下载
export const down = (params) => {
  return axios.request({
    url: 'admins/equipment/download?t='+new Date().getTime(),
    method: 'get',
    params
  })
}

//机组文件
export const jzfile = (params) => {
  return axios.request({
    url: 'admins/fileManager/findByAircrewNumber?t='+new Date().getTime(),
    method: 'get',
    params
  })
}
